#!/bin/sh

in_old=`cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $1 }'`
out_old=`cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $9 }'`
def_in="0"
while true
do
	sleep 1
	in_new=`cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $1 }'`
	out_new=`cat /proc/net/dev | grep eth0 | sed 's=^.*:==' | awk '{ print $9 }'`
	def_in=`echo $[$in_new-$in_old]`
	def_out=`echo $[$out_new-$out_old]`
	echo "["`date +"%Y-%m-%d %H:%M:%S"`"]" "IN: $def_in bytes OUT: $def_out bytes "
	in_old=${in_new}
	out_old=${out_new}
done

